#ifndef __BSP_LED_H
#define __BSP_LED_H

#include "ch32f10x.h"
#include "variable.h"
	


// LED频率1k,0~99脉宽设置
#define TIMER2_PERIOD			99   
#define TIMER2_PRESCALER		719
#define TIMER2_PULSE			10


// 通信端口定义
#define LED_RCC				RCC_APB2Periph_GPIOA
#define LED_PORT  		GPIOA
#define LED_PIN			  GPIO_Pin_1


// 端口操作定义
#define LED_OFF() 		TIM_SetCompare2(TIM2, 0);
#define LED_ON() 			TIM_SetCompare2(TIM2, TIMER2_PERIOD+1);


typedef enum {
	IDEL = 0,  
	OFF,				
	ON,
	TOGGLE,
	BREATH,
	FLICKER_S,  // 慢闪
	FLICKER_F		// 快闪
}LED_STAT;

extern LED_STAT ledStat;   // LED状态

void LED_Init(void);
void LED_TOGGLE(void);
void LED_Breathing(void);
void LED_FLICKER(uint8_t mode);
void LED_Updata(LED_STAT stat);
	
#endif
